﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Events
{
    class Window
    {
        private int x = 0;
        private int y = 0;
        private int width = 400;
        private int height = 400;

        public event EventHandler OnInit;
        public event EventHandler OnPaint;

        private void Paint()
        {
            if (OnPaint != null)
            {
                OnPaint(this, EventArgs.Empty);
            }
        }

        public void Create()
        {
            if (OnInit != null)
            {
                OnInit(this, EventArgs.Empty);
            }

            Paint();
        }


        public Window(int left, int top)
        {
            this.x = left;
            this.y = top;
        }

        public void Resize(int w, int h)
        {
            width += w;
            height += h;
            Paint();
        }

        public void Move(int x,int y)
        {
            this.x += x;
            this.y += y;
            Paint();
        }

        public int Bottom
        {
            get
            {
                return y + height;
            }
        }
        public int Right
        {
            get
            {
                return x + width;
            }
        }
        public int Top
        {
            get
            {
                return y;
            }
        }
        public int Left
        {
            get
            {
                return x;
            }
        }

       
    }
}
